//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Windows.Data;
using System.Windows.Input;

namespace OpenLS.UI
{
    class CommandToIconConverter: IMultiValueConverter
    {
        #region IMultiValueConverter Members

        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            ICommand command = (ICommand)values[0];
            IIconProvider p = (IIconProvider) values[1];
            if (p == null)
                return null;
            return p.GetIcon(command);
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
